interface IuiscrollClassScope extends ng.IScope{
    uiScroll:any;
}

    class uiScroll implements ng.IDirective{
    constructor(){}
       static instance():ng.IDirective{return new uiScroll;}
            restrict:string='E';
            link($scope:IuiscrollClassScope,elements:ng.IAugmentedJQuery,attrs:ng.IAttributes) {  
                let e = $(elements);  
                $(window).scroll(function () {                 //滚动时触发  
                    if ($(document).scrollTop() > 300)         //获取滚动条到顶部的垂直高度,到相对顶部300px高度显示  
                        e.fadeIn(300)  
                    else  
                        e.fadeOut(200);  
                });  
                /*点击回到顶部*/  
                e.click(function () {  
                    $('html, body').animate({                 //添加animate动画效果  
                        scrollTop: 0  
                    }, 500);  
                });  
            }  
        
    };  

angular.module('tms').directive('uiScroll',uiScroll.instance);

// class uiScroll implements ng.IDirective{
//     constructor(){}
//     static instance():ng.IDirective{return new uiScroll;}
//     restrict:string='AC';
//     link($scope:IuiscrollClassScope,elements:ng.IAugmentedJQuery,attrs:ng.IAttributes,$anchorScroll,$location){
//         elements.on('click', function (e) {
//                       $location.hash(attrs["uiScroll"]);
//                       $anchorScroll();
//                   });
//     }

// }
// uiScroll['$inject'] = ["$anchorScroll","$location"]
// angular.module('tms').directive('uiScroll',['$anchorScroll','$location',uiScroll.instance]);
// app().registerDirective("backToTop", function () {  

